import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by zhangjinrui on 17/6/27.
 */

public class Solution187 {

    public static void main(String args[]) {
        Solution187 s = new Solution187();
        System.out.println(s.findRepeatedDnaSequences("AAAAAAAAAAA"));
    }

    public List<String> findRepeatedDnaSequences(String s) {
        HashMap<String, Integer> mp = new HashMap<>();
        List<String> ret = new ArrayList<>();
        if (s.length() <= 10) {
            return ret;
        }

        for (int i = 0; i <= s.length() - 10; i++) {
            String ns = s.substring(i, i + 10);
            if (!mp.containsKey(ns)) {
                mp.put(ns, 1);
            } else {
                mp.put(ns, mp.get(ns) + 1);
            }
        }
//        System.out.println(mp);
        for (String ns : mp.keySet()) {
            if (mp.get(ns) >= 2) {
                ret.add(ns);
            }
        }
        return ret;
    }
}
